function laohuji(sel) {
	this.domsu = document.querySelector(sel);
	
	var boxRect = this.domsu.querySelector(".laohuji").getBoundingClientRect();
	console.log(boxRect)
	
	this.h = 10;
	
	
	this.sz1 = document.querySelectorAll(sel + " .laohuji div")[0];
	this.sz2 = document.querySelectorAll(sel + " .laohuji div")[1];
	this.sz3 = document.querySelectorAll(sel + " .laohuji div")[2];
	this.bgsize = "background-size: 100% 1000%;";
	
	this.init();
}
laohuji.prototype.init = function() {
	this.seti = null;
	this.r1 = 0;
	this.end = false;
	
	this.t1 = 0;
	this.b1 = 0;
	this.c1 = this.h * 2 * 10;
	this.d1 = 200;
	
}

laohuji.prototype.Linear = function(t, b, c, d){
	return c * t / d + b;
}
laohuji.prototype.quadEaseIn = function(t, b, c, d){
	return c * (t /= d) * t + b;
}
laohuji.prototype.quadEaseOut = function(t, b, c, d){
	return -c * (t /= d) * (t - 2) + b;
}
laohuji.prototype.quadEaseInOut = function(t, b, c, d) {
	if((t /= d / 2) < 1) return c / 2 * t * t + b;
	return -c / 2 * ((--t) * (t - 2) - 1) + b;
}


laohuji.prototype.start = function() {
	var self = this;
	var w = this.h;
	this.sz1.setAttribute("style", "background-position-y:0;")

	var r1 = self.r1;
	var r1v1 = 0;
	var r1v2 = 0;
	
	
	this.seti = setInterval(function() {
		self.t1++;
		
		if (self.end) {
			self.r1 = self.quadEaseOut(self.t1 , self.b1 , self.c1, self.d1);
//			console.log(self.r1)
			if (self.t1 >= self.d1) {
				clearInterval(self.seti);
			}
		} else {
			if(self.t1 <= self.d1) {
				if (self.t1 == self.d1-1) {
					r1v1 = self.r1;
				}
				if (self.t1 == self.d1) {
					r1v2 = self.r1;
				}
				self.r1 = self.quadEaseIn(self.t1 , self.b1 , self.c1, self.d1);
//				console.log(self.r1)
			} else {
				self.r1 += (r1v2 - r1v1);
			}
		}
		
		self.sz1.setAttribute("style", self.bgsize + "background-position-y:" + self.r1 + "%;")

	}, 1000 / 60);
}

laohuji.prototype.funend = function(gw){
	var r1 = this.r1;
	var h = this.h;
	
	var quan = Math.ceil(r1 / h / 10);
	this.t1 = 0
	this.b1 = this.r1;
	this.c1 = h * (quan+2) * 10 - (this.r1) + ((gw || 0) * 10);
	this.d1 = 250;
	
	this.end = true;
	
	
}


